Where can I move this function so that it is defined