refactor kml.py