Change when the wait group is created and used in input