Added waitForProcess call