same as before, moved index
more helper functions and index objects