Improved test cases.
Added test case for bogus modes.
Merge remote-tracking branch 'origin/master' into develop