more compilable version of 2d model