Some documentation and cleaning up