Final refactoring of docs and tests