adding better substring for the final comma