Refactored DB manager and DB session.