decide_next debugged. Need to fix record_log.