added documentation, minor cosmetic changes.