Extract anon function to named funciton listen