Refactor for readability

@koenpunt @harvesthq/chosen-developers 

This is a simple refactor with a merge target of `koenpunt-word-boundary-matching`, not `master`. I find this to be much more readable than what exists in that branch.

What say you?