Cleanup match logic a bit