refactoring a method to now use an Action as a parameter.