Corrected rotation order and cleaned up some old code.