Reorganized IO into a module

Added beginnings of support for textgrids