VQ and CSL fixes

Fixes removing the double edges for VQ and CSL.
Also, prevented copying of whole data in functions using
pass-by-reference.