Split input data from valid data

Separate new input data from already validated data. This speeds up validation
since it only needs to be run on new data. A couple of data integrity tests are
added too.