Reviewed-by: mullan, weijun, ngthomas
Added code to deal with the index case specially. Reviewed-by: mullan