partial commit resolving the stats ui;
small fixes to the queries