made into a module so can do a 3d->2d version in place