Refactor and add rubocop rake task