Added js to ensure that unchecked debug statements don't throw unexpected errors.
Added code to escape input in form to avoid cross-site scripting issues.