Adding ability to query the history database