add user definable callback function