Improve the code-style of addDashes function