similarity algorithm updated for program