memory optimizations to testing method