cleaned up alarm logic