Support for where clauses, let bindings and case expressions in case splitting

This fixes #395 and adds support for case splitting in more places. Also, I added some tests.