Refactoring Controller and Factory