Refactoring the code that creates resources.