Implement control inversion for result handling.