Improve similarity checking
Some more fixes