Rake tasks code refactoring.