#136 updates before refactoring
#136 change dma to mem
#136 refactoring
#136 more refactoring