Overhaul validation code

I'm going to need to be able to validate on subfields, so the old
validation code was not going to cut it. I've switched it for a more
declarative version which recursively applies validate.