trying to add directory function back