Some progress... but still get inconsistent hanging and errors from phantomjs.