change to async database
add debug prints