Added thread.join() in main.cpp