finishing the refactoring