memory optimization

because dear lord 3n memory usage is not ok