Formatting.
Rename functions to derive constraint keys.
Add functions which derives queries from key constraints.