changed logic, create_mesh works but uses a lot of memory