Attempt at reducing memory usage