Grammar extensions and test cases added. Not tested.