Improved code for autonotification