updated code for MDB