move temporary global function creation to introspection