Add currying and memoization.
Cleanup and tweakage.
Assorted cleanup.