Sanitize inputs and outputs

Sanitize data input and escape data outputs
Improve some function comments
Remove unused php file