Tested for case 1~8