added initialization of uninitialized values and enabled multiple triggering levels