added scopes
Update module loader to use scopes
rearranged functions in module loader and added debug logs
remove chdir and store module loader in params