generate replacement callback in a separate method