Moved logic to phantom JS callback to have certain variables in scope.  Improved test reporting and added more event listeners for debugging.