grouped and merged lines for visits