Moves validator code to one file, validator.js, so it is easy to use that is other projects too. Github issue#1