added functionality for multiple goroutines