Add serve function to gate the creation of the goroutines.