add some modifications to the  remove() method