Merge "Refactoring the res manager code."