Add DB indexes and some optimizations