Added a filter function
Some xss fixes

filtering $id reflection