Made the code compatible with the list view