Major cleanup of optigraph code.