Add test case + improvements