added some documentation and some clean up