Tidy up db stats page. Merge test_email and email_queue functionality.