Use WaitGroup instead of hack to wait for all go routines to finish
Write to log instead of stdout