Restructuring so that the Replit object owns the function, needed to handle monkey-patching better.