upgraded db layer to better support tests