more massive refactoring action to pull out togetherjs code