more various refactors to memory interface