rethink TEI to json and add generic library of functions