added requirejs error handling for failed scripts
cleaned up javascript: consistent indentation (spaces), commenting, removed unneeded js