O adsorption and incipient oxidation of the Mg(0001) surface