Adding more test cases and minor fixes