fixed dls and did some pruning for both functions.