improved memory usage