Rewrite some validator logic
Fixes #26
Fixes #27
Fixes #29