Set alarm function modified