Some syntax changes in grammar and compression of code, fixed some logical errors