added alarm function