Implemented persistence functionality