replaced all Manifests with ClassTags
getdecomposefun returns a type checking function