completed persistance layer and tests