Splitting up parts of createIndex into files of (poorly encapsulated) utility functions