Fixed issues with 'memoize' and added unit tests for where/memoize operations to main test.