got docco to document most of the code