modified main.c and map.c