Added logprobs handling