Add documentation and minor code-refactoring

Done