[BUG #7922] refactored data loading
[BUG #7922] moved data loading to separate file
[BUG #7922] improved error handling
[BUG #7922] further refactoring