refactoring and changes for cancel alarm