Modified the PEG to return either "valid" or "invalid", removing time-consuming exceptions.