Some code cleanup, new Makefile and a bit better C