Complete rework of daemon framework