DB optimizations

Less calls on DB for the same thing.