Added some derived rules + more rule test coverage, and bugfixes.