some indenting and shortening code on daemon