order terms by conditions
slightly more complex aiml example working