Modify initializer to generate shim dynamically