Add application of multiple rules
Fix length calculation
Add variable start symbol