fix unix compilation
clean up code, update documentation
check update of global variable works on daemonized version