Improved match functions