Added some documentation and minor fixes.