refactor rake task with collect