Refactoring & docs