Refactor static resource loader