move Memory into a file for unused code, and tweaks to Matching

Tested on darcy.

optimized fractal algorithm took 15.47 seconds