Code for map with db