add conditions to skip rotating and reversing