Rotate func corrected