updated some queries pulling data from flat_tables