Implemented issue #156 with improved search/compare method

Use a HashTable for caching

For reference, issue #205