Refactor file architecture