Rubocop fixes and DRY cleanup