made changes to remove function

made changes to remove function