Completed solution, needs trimming to speed up: next if over perimeter.. etc