refactored rotation update into function

also improved rotation update function by eliminating loopholes