refactored to comply with rubocop