Added a flag to disable global optimization