wrote my own version of example1:sim_distance