insert rules almost complete.
todo: test, output check.