Code reduction mostly complete