Repeating loop to find orientation

optimised loop from wrox