generalize validation