Use tuples instead of lists
Check for repeated values
Implement substitution for theories