Memoize

This change was already reverted in 905b5d4d11cf1e56137fea1e68eb503863f1b113