Added rotation handling