Still testing.
Speed and memory optimizations