rearranges animation logic