For first error I have no time to check for all code.
For second error:
"This message is generated when corresponding lists or sublists on opposite sides of an equation do not have the same length.An error occurs because the list on the right side of this assignment does not have the same length
as the list on the left side of the assignment"
for example:
{var1, var2, var3} = {1, 2, 3, 4}
{var1, var2, var3} = {1, 2, 3} (*The correct code*)