modularized the resource loading