make rule removal iterative instead of recursive
make rule removal iterative instead of recursive