Refactor file primitive