refactored use 1 db