refacor to use db url