working validation script