moved validate logic into validator class