Tuning the properties of graphene using a reversible gas-phase reaction