added binary insertion of keyframes