Cleanup, documentation, function additions.