Changes to delete function to understand linked list