changed to C99 standard
changed all printfs to debug_print with a #define