code cleanup; doc updates