updated code to leave non-ending commas