Improve pmatch