Refactored persistence, now it works