Solved some bugs and updated the residence values in tables