Refactor canRotate