Switched history retrieval from session to db.