refactor updateDir