Reorganize match-a-pattern and fixup base-case version
Use new match-a-pattern macro where appropriate