Changed animation engine internals and a few other bug fixes