Alarm and algo

various commits, i leave them all in one branch, 'cause it's easier with the refmdb