added use of compiler flags in Makefile; eliminated loads of compile warnings; marked global variables
added some comments; removed some space