Grammar and variable fixes