change validation way from method to class

fix for #3