Added some documentation and minor cleanup