Fixed a HUGE memory leak and changed the way the energy network works