Replaced verbose_flag with built-in LOG_VERBOSE.
Moved ipc and sock_file from main.c to ipc.h.
Reorganised and cleaned code.