add waitForLoad function. closes #17