Replace order matching trigger with a function