Driver script
Make main thread wait for other threads before exiting
Integrated Jyoti's indentation fixes