Refactored loadComponents method