order processing script, small fixes, removed some cruft