Changed parser and fixed rules implementation