Cleaned up GeoQuery code to try to reduce complexity and modularize it