did some clean ups; added some comments