Got rid of all valgrind error messages. Basically I'm really bad at
using arrays properly. So now I'm going to move all the changes from
this commit over to the real codebase.