Memoize messages to improve efficiency