refactored code to load from file into separate method