Refactored common code, added WaitHandle to make sure output is read completely (MP2-428)