Store goals in a TypeMap, instead of a list

  This should reduce the number of redundant constraints getting generated.