Fixed invert function and wrote unit test for it
Merge remote-tracking branch 'origin/master'