some refactoring of SD factory