Better (not perfect) group handling

Fixed the parser, and improved matching for groups in the map.