simplified the code by using Kiama's version of the memo combinator for strategies