Rake tasks refactoring