Some adjustments to coordinate checking to avoid index errors
Adding some unit tests to try and figure out how they work. Will be improved, I promise.