Trying to fix out of heap space issue