moved input validator to separate file