updated handler.c and main.c