refactored loading of data