refactored reading and update of lastSeen map