New way of reading and writing the catalog files. Untested.