changed from session storage to db