added foreign keys and other constraints