In situ controlled reactions and phase formation of thin films on GaAs