Small fixes + docs + refactoring