fixed a lot of memory leaks and switched to the gnu99 c standard (to allow for(int i = 0 ...) loops)
resolved conflicts