Adding rotation function and fixing rotations