formatting and templating messages; ajax loading plus paging