cleaned up frame_length_detector