Simplify index boilerplate code