Move some logic from controller directly into daemon so it can be overridden.