refacto index preparation