Restructured the code, and added notifications in more places in the batch code