extract validation to separate module