works! what a struggle. only tested in 2D