better rule parsing