DB improvements

Change-Id: Ib25fc69132ce90ba20eb8a6a410ed7e3f86f2218