Clean-up some of the optimizer code.