replace ended callback with success and failure callbacks (#58)