Added options separate from quantities to determine active orders.
Fixed bugs.