Finished the rotation code. Pending testing.