Factoring out a cleaner memory interface