code refactoring for Bsim DMA integration