Added foreign keys in relevant places.