Fixes #9. Adds foreign keys