add directory handling