aded end and next interface to callback for control flow