Implementation of mapping db functions

Todo: Proofs