Fixed the linker memory issue

I had to change how stuff was being declared and some of the memory
management stuff