Added :g task to Rakefile and refactored