Surface chemistry and electronic structure of nonpolar and polar GaN films