simplify and deduplicate some validator code
a bunch of code cleaning