Refactor
Stop matching when the first matching is found