removed onclick tag from error modal in main.html
modularized a bit of the code, and added modal to catch unexpected errors from the server side.