isValid method has been added