added callbacks to some DB functions, implemented test harness