Updated rotation logic