apply rubocop recommendations
minor refactoring