fixed some c generation issues, generalized the structure. code now keeps track of correct tabbing