Invert percentage; re #1477

This is a work in progress pull request that adds support for percentages in the invert() function. 

I have a few questions relevant to the comments on #1477 and will comment there.