Generalization of common fixed point theorems for weakly commuting maps by altering distances