Ported the code inside Watch task