First (broken) attempt to generate disatance matrix