validating logic