Added testcases and fixed failing cases