Refactoring and test fixture