simplify link-coloring code