adding the sort of the subshapes