Add functionality to wait for callback