Added the total and the last alert

Added the total variable and printed it to the console and also added
the last alert