Code cleanup and updated documentation.