optimizing memory usage

down to 27154/1403