code cleanup for `on_progress` and `on_finish` callbacks