cleanup and commented code for Model and GeoMath