Finished Makefile and compatibility fixes