Readded foreign keys with better connection