refactor loading of csv