Improvements to animation

Streamlined and commented code, some updates still needed.