Moved third party libs to lib folder
Added code to wait for instances to terminate