Added isValid method