Fix up overcomplicated logic to get friends search working right.