Refactored Code
Fixed bug with wait group