Factored callback creation into methods to allow testing