Adding more documentation and cleaning up