contraction and decontraction algorithms