refactor file expansion into io module