Refactoring code to prepare for checking quadrant accuracy