Add duration to flow
Add onend callback for flow