Added input validation to address CSS vulnerability