added a counter to limit number of executions of rotations