refactor short term memory