added test/demo for Wait() function