new update including waitForPage function and minor tweaks