some optimizations to reduce unnecessary rules