Cleaned up the main JS file and put in some logic for handling uncaught exceptions. No more crashes!