Revert "Stefano's patch for user-defined primaryType"

This reverts commit a3506b679ba0d6ba62dc7736ac12ecf324fee53c.