complete daemon implementation
add comments