Some progress made. Problem though: user provided match order is not preserved after processing. this has gotta be fixed