Added documentation and fixed rotation bug