added caching of similarities