tried changing syntax to with:
fixed some syntax issues.
added watchdog class from stackoverflow