optimizations and memory management. fixed user avatar deletion.