fixed a bug when an anchor forms a complete straight line
put private functions into namespace, slight tweak (solid lines look solid!)