Added logic to tie orders with encounters