slight refactor of persistent storage functions