When rotation was < 0, we were subtracting it from 360, which was producing a number larger than 360. We should have been adding it to 360, not subtracting. Moved angle wrapping math to a separate function.