You could take it out like you did but put in a condition. It's not 100% clear what the condition is for resetting the frame to 0, is it when all animations are complete? A reset function might be best used here.
Something like this might be useful to control the reset?