updated validator, fixed some minor issues and made it more readable

Refactoring, bugfixing (issues around required values in path) and some commenting