Finishing mdb_func