Changed: Session management to use the db.