added history view and refactor db classes