Added logic to handle partially filling market orders.