Using legacy optimization callbacks
Introduces legacy optimization callbacks.