I'm having a hard time understanding this method. In particular, the variable names `fn` and `mem` don't communicate very much. Could you add a jsDoc-style comment to describe its functionality?