A little code clean up and some more documentation.