modified needed parameters for findPrevMessage and findNextMessage