Trying to get the rotation function correct