moved unmarshalling inside goroutine