Added an error function (untested) and re-indented index.html