Documentation & refactor