working through logic of rotation. fixed logic for calculating theta