Little refactoring, improved docs