I wonder if the coord comparison code will give you the inside of this loop for free. Did you look at that?