Added functionality to check if $match actually exists