Templates decomposition