similarity now uses less memory