add memory mechanism