Linear comment attachment

Issue 522: Linear comment attachment algorithm