Refactoring to be more callbacky