More documentation and code-cleanup