Added helper func. queryDB; standardized callbacks