Improvements on range-finding algorithm. Edge case does not work at cert...

...ain points because the tiles are not aligned properly.