Added some missing documentation. Modest code cleanup in some places.