BIG CHANGES -- Replaced original queries with ones using our precomputed
tables; still super duper buggy but major functionality is there