BugFix: AlarmActivit did not quit in all scenarios

When button "Shut of alarm" was pressed the alarm did not exit. This has
now been solved. Also some refactoring was done.