Refactors optimizer module api slightly