More documentation and improved formatting