Changed to using 'tr' instead of 'sed' for character replacement