Added deamon modoe to main function