added timing offset and cleaned up the way the index is done