Refactored prepare resource framework