Bug fixes + XSS implementation

Some bug fixes, also XSS vulnerabilities and fixes have been
implemented.