More code cleanup and a little documentation.