Some unnecessary waitForFrame commands deleted