Corrected custom_remove function and note test case