Finally found a way to insert brackets manually, finished restrictions with them and beatified code for productions
Added test case and corrected bugs
Removed another bug, no works again.