refactor indexed i/o to another package