Merge pull request cliffordwhansen. Cleans up code and improves doc formatting