refactor track index handling