started re-implementing global opt