Working version with intersection on keys for table