Function fixes, conditional sections, misc.