Factor out callbacks.