linRotate function added