added daemon function