Refactors some logic out of keyframe-forms.js.