extracted method in validator