Rewrite function Cissq and make it more efficient