improved database api