Added documentation, and general clean ups