Fix for space between comma and stocks.

Also handles trailing comma. Adds doctests.