Remove while loop that stalled browser, add hooks