Added the rotation functionality and a lot of other stuff