added validation code to couch app

Copied over all necessary validation code to the couchDB app after
testing.