Refactored how resources are loaded