updated function for rotate. (problem#19).