reducing memory usage, not tested