First version of rotation code.