Added similarity function for building class