refactor list inot a method