method for similarity and Main invocation