Persistant disk

Before merging this pull request, the refactoring pull request has to be merged into the master branch.