Added closure around graph worker functions.