Adding a dispose function to remove the list.