remove types and flatten composition