Refactor Memory Interface