refactored camera code and fixed camera elevation bug