Issue 497

I added a lot of new rules and tests. This should solve Issue #497.