Begining refactor of resource factory.