Added error messages and htmlspecialchars