DB methods for mappings and small refactor