Refactor the validation package to make it more adaptable