changed the order by logic with lastmodified date