Refactored code and added rakefile .