created structure of daemon and changed names of main functions