changed parser to simpler rule based algo