Changed the shutdown switch from a constant polling function to an event_detect