Added XSS prevention and error indicator