Tests, refactorings, docs.