Added a simple test case
Clean up c files
Improved error handling for globals during the code gen phase