refactor load resource