refactor factory for association