added pagination to messages.