added code for rotating during runtime