Updated to use watchdog, also bugfixes