first multicore version using waitGroup and done channel
added profiling flags