WIP persistent storage, needs huge refactor