Fix cleaning and move to subfunction
Fix cleaning and move to subfunction

thunder-project/thunder,zhwa/thunder,kcompher/thunder,poolio/thunder,mikarubi/thunder,j-friedrich/thunder,jwittenbach/thunder,pearsonlab/thunder,pearsonlab/thunder,broxtronix/thunder,kunallillaney/thunder,kcompher/thunder,oliverhuangchao/thunder,zhwa/thunder,mikarubi/thunder,broxtronix/thunder,poolio/thunder,j-friedrich/thunder,kunallillaney/thunder,oliverhuangchao/thunder