Fixing patters caching and path testing on diff method. (closes #2)