class for validator

I'll keeping snippets as and when I find a need.