Merge "Refactor resmanager code"