refactor load data between file and memory