WIP refactor out to rake task