Change database interface to use callbacks