Restructuring in the code to group all code for interpolation and animation together