Refactoring animation and module loaader code