Implemented watchdog timer function