added code gen and demo to verify that it works