make it run better for large numbers of frames