Change goroutine to trigger at the end