Improved db operations