Changing AnimationMachine so that it can handle complex animations (may have caused memory leaks), still need to modify tests