move icon construction into function