further refactor of db code
Merge branch 'master' of https://github.com/makilian/Mist