Rewrote validation function

Also fixed a small bug inside the validator and flagged a bug in the
database record.