implemented addCommas() algorithm