glitchavi: separating out the setup from the actual frame-selection function