large refactoring and dynamic chunk loading