Rewrote order numbering code