add input validation
prepare validation/integrity checking functions