Fix Memory leaks from Valgrind

These modifications fix some valgrind leak check errors. Major modifications were made to how the unionized energy grid is formed. Now, built in linked list types and procedures are used instead of the manual operations before. This made freeing this object must easier.

Some additional memory errors that are not fixed will be listed in comments below.