Some refactoring and start rework of MemoryMedium