Rewrite function Cissa and make it more efficient