Moved all the database management logic from rmtmod into new module dbmgrmod.