Added stop functionality and loop for callback functions