Added memory allocation routines
Restructuring C source files