added alarm functions, fixes