optimize alarm generator