Added waitgroup so that every thread is started before the wenserver gets started
Code cleanup