refactored to address Rubocop