Factored out DEBUG and CFLAGS + more strict compilation and fixing resulting errors