changed the numOfRotationsNeeded function