Changes to daemon function