added a more permisive matching logic