Implemented auto rotation