Lowered the memory usage by about 100mb.