More code clean up and documentation.