Refactor DB gems