Replaced use of _.some
Replaced use of _.trim
Removed unused utility function