added better animation handling

because josh said i can't use global variables.  spoilsport.