Got around problem with extra parameters in kernels. Very ugly though.
generating code that runs somewhat. Still doesn't initialize arrays. Must use array index function.