Added more test cases and support for misc corner cases