Added documentation and refectored some of the code to better reflect the KML spec.