Add optimized queries for looking for a page after the specified message.