leaving distsim original implementation