Rough draft of consistency check code

Extremely rough consistency check function written.