Improved logic of retrieving replies.