refactoring the code to add anim stages in addition to the anim step and substep