use a int ref to keep the current decision level