added some docs, and a general cleanup.