Changed group determination to use newline char