rework db connection