Added test cases and fixed broken cases