added leaf handling for nicer data setup