Extract icon_dir function to be  a separate file

extract icon_dir function to be a separate file