move validator to separate class