Restructure the rotating function in an attempt to make it more concise.
Reduce rarely used member references.