added other peoples reference code for rotation