somewhat improved memory usage