Fix endless loop and other errors. Basic support for animations in the variants.