removed lot of legacy code in memory system and removed corresponding macros (nw)