Merge pull request #1 from gwicke/master

Some small tweaks for discussion
wip; expression rewriting
WIP: Some more fixes & improvements to rewriteExpression