migrating index formation to reusable classes