detail + test + refactoring