code with comments on the alarm manager