Moved reader func outside of goroutine so its calling function waits