added logic for getting last messages after a certain uid