Various code updates and security fixes

Updated code to reduce XSS vulnerabilities and removed JavaScript
dependency