first working version  of the persistence layer