add callback to optimize method
add callback to optimize method