Iterating through PatternMatch to detect returned string (with bugs).