Optimized growth conditions and properties of N-type and insulating GaN