Refactor some schema validator stuff