added monotone optimization. not sure if its working correctly yet