finishing up the refactoring