add functionality to call user function immediately before optimization