Escaping and data validation added