have first pass at an optimizer loop going. Now to generate output optimized beamcode output to disk