Avoiding memory heap space error.