Added detection of frames count.