More code restructuring and UI Animation Fix