Added 10 test cases and a couple of minor fixes.