generalize validation more