Better memoization of instances and layers.
Merge pull request #11 from freerunningtech/layers

Better memoization of instances and layers.