Improved match macro