Moved a lot of complexity back into codemuncher