Refactored to put extracting icon in a single location