Move printing behavior into a helper method and pass it a variable