I was supposed to pass this function as a callback