memory refactored