Refactor into a callback.