Added documentation and made some cosmetic changes. Nearing completion.