Small refactor and documentation