code for decomposition