Updated code for smoother rotation

Updated code for smoother rotation