create a new function in router to help