Slight optimisation, don't explore perimieter until necessary.