reworked index, slice, and trigram to use a template instead of the ghetto char*, switched to refs instead of pointers when passing reader/writers