changed phi to theta for pitch variable