A more elegant way to split string into group, fixed #1