Fixed bug. Now it can run without running out of memory