Removed redundant code

localdist New and newFromConfig were almost the same, I've refactored and cleaned a code.