added some validation, xss-protection and some small fixes