optimzing memory usage for actual frame
adapted some comments