refactor DB structure