Updated migrations with correct foreign keys, added test cases, and limited dictionarys to 20 lines