Adds XSS protection for user input
Moves common code to abstract class, improves security and tests
Merge pull request #130 from nsendetzky/master

Moves common code to abstract class, improves security and tests