added support for alternative on-disk formats

This opens up a way to implement #7 in another module.