Adding a function to search and remove an element from list