added exhaustive inference code