The role of oxygen and hydrogen in GaN