removed json_encode
removed unused code
changed input filtering to not be hardcoded