added error checking for trailing & double commas