Added direct lookup of last valid value