Added optional callback, and access to db object directly