Added daemon configuration via cmd option; split usage() and other functions to libs