Move new message calculation to page_handler.