Copied and refactored functions intro into IIFEs