More major refactoring of coordinate determination logic.