refactored with files dir