second refactoring.  placed method in separate file