Optimization

Optimization in certain method calls to avoid running out of
heap memory.