Custom validity check