replace hardcoded optimizer by modular optimizer