validating codes