Almost done refactoring rake task
Finish refactoring rake task