Refactor callbacks and add some specs. [#80441132]