Lot of refactoring + latlong bug fixing.