Refactory using factory