added isValud function