split primary index functions into seperate files