Modular saving to files. Fixes #36, fix #56