Add watchdog.
Integrate watchdog.
Bugfix to watchdog and clean up some warnings.