#291 More speedup's by using indexes and insert replace