Refactoring cross tables and adding support for multiple primary keys.