Some syntactic changes:
- more use of auto
- moved std::function to a using
 Removed queue not empty condition when exiting thread because that will cause the destructor to hang until the queue is empty