refactoring & test