AbstractFactory added and refactor