Resolving memory overload issue