Refactored db and mappings