Refactor to fix Rubocop offenses
Merge pull request #2069 from orendon/fix-rubocop-offenses

Refactor to fix Rubocop offenses